//package com.kevin.file.run;
//
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.OutputStream;
//import java.nio.file.Files;
//
//import org.apache.commons.fileupload.FileItem;
//import org.apache.commons.fileupload.disk.DiskFileItem;
//import org.apache.commons.io.IOUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.stereotype.Component;
//import org.springframework.web.multipart.MultipartFile;
//import org.springframework.web.multipart.commons.CommonsMultipartFile;
//
//import com.kevin.file.feign.FileFeign;
//
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//@Component
//public class FileRunner implements CommandLineRunner {
//
//	@Autowired
//	FileFeign fileFeign;
//
//	@Override
//	public void run(String... args) throws Exception {
//		InputStream input = null;
//		OutputStream os = null;
//		try {
//			File testFile = new File("/Users/yekongle/PDF/English/625words.pdf");
//
//			FileItem fileItem = new DiskFileItem("file", Files.probeContentType(testFile.toPath()), false,
//					testFile.getName(), (int) testFile.length(), testFile.getParentFile());
//			input = new FileInputStream(testFile);
//			os = fileItem.getOutputStream();
//			IOUtils.copy(input, os);
//			MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
//			String resultString = fileFeign.fileUpload(multipartFile);
//			log.info(resultString);
//		} catch (Exception e) {
//			e.printStackTrace();
//		} finally {
//			try {
//				if (os != null) {
//					os.close();
//				}
//				if (input != null) {
//					input.close();
//				}
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//		}
//	}
//}
